const initialState = {
  content: '</br>',
};

export const HtmlActions = {
  HTML_UPDATE: 'html_update',
  HTML_RESET: 'html_reset',
};

export function updateHtml(payload) {
  return {
    type: HtmlActions.HTML_UPDATE,
    payload,
  };
}

export function resetHtml() {
  return {
    type: HtmlActions.HTML_RESET,
  };
}

export default function html(state = initialState, action) {
  switch (action.type) {
    case HtmlActions.HTML_UPDATE:
      return {...state, ...action.payload};
    case HtmlActions.HTML_RESET:
      return {
        content: '</br>',
      };
    default:
      return state;
  }
}
